-
Notifications
You must be signed in to change notification settings - Fork 8
implement prepare publish (create only) #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2b6a284 to
6fef6a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the preparePublish function for creating publish operations, injects a __schema reference into every entity instance to support publishing, updates exports in hypergraph-react, refreshes tests to assert the new __schema field, and integrates publishing into the example app UI.
- Inject
__schemametadata onfindOne,findMany, andupdatesopreparePublishcan access schema definitions. - Add
prepare-publish.tswith create-only publishing logic and export it inhypergraph-react. - Update tests and example app code/routes to use
preparePublishand expect__schema.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/hypergraph/test/entity/entity.test.ts | Updated tests to include __schema on returned entities |
| packages/hypergraph/src/entity/update.ts | Inject __schema in updated entities |
| packages/hypergraph/src/entity/findOne.ts | Inject __schema in findOne results |
| packages/hypergraph/src/entity/findMany.ts | Inject __schema in findMany results |
| packages/hypergraph-react/src/prepare-publish.ts | New preparePublish implementation (create only) |
| packages/hypergraph-react/src/index.ts | Export preparePublish from package API |
| packages/hypergraph-react/src/internal/use-query-public.tsx | Inject __schema in public query parsing |
| packages/hypergraph-react/src/use-query.tsx | Clean up unused useGenerateCreateOps import |
| apps/events/src/routes/space/$spaceId/events.tsx | New Events route component integrating publish UI |
| apps/events/src/routes/space/$spaceId.tsx | Add link to Events page |
| apps/events/src/routeTree.gen.ts | Register /space/$spaceId/events in route tree |
| apps/events/src/components/user-entry.tsx | Add Publish button and call preparePublish |
| apps/events/src/components/events/events.tsx | Use preparePublish + publishOps in Events UI |
| apps/events/src/components/todo/todos-public.tsx | Remove deprecated create-op helpers |
Comments suppressed due to low confidence (2)
packages/hypergraph-react/src/prepare-publish.ts:1
- There are no unit tests covering the new
preparePublishlogic. Add tests to validate thatpreparePublishcorrectly serializes properties, relations, and returns expected ops for create-only scenarios.
import {
packages/hypergraph-react/src/prepare-publish.ts:1
- [nitpick] The new
preparePublishfunction lacks a doc comment or usage example. Consider adding JSDoc explaining parameters and the high-level create-only publishing flow.
import {
| const [editMode, setEditMode] = useState(false); | ||
|
|
||
| const handlePublish = async () => { | ||
| const result = await preparePublish({ entity: user, publicTargetSpace: 'abc' }); |
Copilot
AI
Jun 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to preparePublish uses publicTargetSpace instead of the expected publicSpace parameter name, causing a runtime or type error. Rename the property to publicSpace.
| const result = await preparePublish({ entity: user, publicTargetSpace: 'abc' }); | |
| const result = await preparePublish({ entity: user, publicSpace: 'abc' }); |
Copilot uses AI. Check for mistakes.
No description provided.